3.12 \(\int \cot (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx\)

Optimal. Leaf size=75 \[ \frac {a^2 (A-2 i B) \log (\cos (c+d x))}{d}+2 a^2 x (B+i A)+\frac {a^2 A \log (\sin (c+d x))}{d}+\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d} \]

[Out]

2*a^2*(I*A+B)*x+a^2*(A-2*I*B)*ln(cos(d*x+c))/d+a^2*A*ln(sin(d*x+c))/d+I*B*(a^2+I*a^2*tan(d*x+c))/d

________________________________________________________________________________________

Rubi [A]  time = 0.16, antiderivative size = 75, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3594, 3589, 3475, 3531} \[ \frac {a^2 (A-2 i B) \log (\cos (c+d x))}{d}+2 a^2 x (B+i A)+\frac {a^2 A \log (\sin (c+d x))}{d}+\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d} \]

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]

[Out]

2*a^2*(I*A + B)*x + (a^2*(A - (2*I)*B)*Log[Cos[c + d*x]])/d + (a^2*A*Log[Sin[c + d*x]])/d + (I*B*(a^2 + I*a^2*
Tan[c + d*x]))/d

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3589

Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]))/((a_.) + (b_.)*tan[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Dist[(B*d)/b, Int[Tan[e + f*x], x], x] + Dist[1/b, Int[Simp[A*b*c + (A*b*d + B*(
b*c - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a
*d, 0]

Rule 3594

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*B*(a + b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^(n + 1))/(d*f
*(m + n)), x] + Dist[1/(d*(m + n)), Int[(a + b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^n*Simp[a*A*d*(m + n)
 + B*(a*c*(m - 1) - b*d*(n + 1)) - (B*(b*c - a*d)*(m - 1) - d*(A*b + a*B)*(m + n))*Tan[e + f*x], x], x], x] /;
 FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && GtQ[m, 1] &&  !LtQ[n, -1]

Rubi steps

\begin {align*} \int \cot (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d}+\int \cot (c+d x) (a+i a \tan (c+d x)) (a A+a (i A+2 B) \tan (c+d x)) \, dx\\ &=\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d}-\left (a^2 (A-2 i B)\right ) \int \tan (c+d x) \, dx+\int \cot (c+d x) \left (a^2 A+2 a^2 (i A+B) \tan (c+d x)\right ) \, dx\\ &=2 a^2 (i A+B) x+\frac {a^2 (A-2 i B) \log (\cos (c+d x))}{d}+\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d}+\left (a^2 A\right ) \int \cot (c+d x) \, dx\\ &=2 a^2 (i A+B) x+\frac {a^2 (A-2 i B) \log (\cos (c+d x))}{d}+\frac {a^2 A \log (\sin (c+d x))}{d}+\frac {i B \left (a^2+i a^2 \tan (c+d x)\right )}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 3.16, size = 201, normalized size = 2.68 \[ \frac {a^2 (\cos (2 d x)+i \sin (2 d x)) (A+B \tan (c+d x)) \left (\sec (c) \left (\cos (d x) \left ((A-2 i B) \log \left (\cos ^2(c+d x)\right )+8 d x (B+i A)+A \log \left (\sin ^2(c+d x)\right )\right )+\cos (2 c+d x) \left ((A-2 i B) \log \left (\cos ^2(c+d x)\right )+8 d x (B+i A)+A \log \left (\sin ^2(c+d x)\right )\right )-4 B \sin (d x)\right )-8 i (A-i B) \cos (c+d x) \tan ^{-1}(\tan (3 c+d x))\right )}{4 d (\cos (d x)+i \sin (d x))^2 (A \cos (c+d x)+B \sin (c+d x))} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]

[Out]

(a^2*((-8*I)*(A - I*B)*ArcTan[Tan[3*c + d*x]]*Cos[c + d*x] + Sec[c]*(Cos[d*x]*(8*(I*A + B)*d*x + (A - (2*I)*B)
*Log[Cos[c + d*x]^2] + A*Log[Sin[c + d*x]^2]) + Cos[2*c + d*x]*(8*(I*A + B)*d*x + (A - (2*I)*B)*Log[Cos[c + d*
x]^2] + A*Log[Sin[c + d*x]^2]) - 4*B*Sin[d*x]))*(Cos[2*d*x] + I*Sin[2*d*x])*(A + B*Tan[c + d*x]))/(4*d*(Cos[d*
x] + I*Sin[d*x])^2*(A*Cos[c + d*x] + B*Sin[c + d*x]))

________________________________________________________________________________________

fricas [A]  time = 0.72, size = 97, normalized size = 1.29 \[ \frac {-2 i \, B a^{2} + {\left ({\left (A - 2 i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (A - 2 i \, B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + {\left (A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + A a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

(-2*I*B*a^2 + ((A - 2*I*B)*a^2*e^(2*I*d*x + 2*I*c) + (A - 2*I*B)*a^2)*log(e^(2*I*d*x + 2*I*c) + 1) + (A*a^2*e^
(2*I*d*x + 2*I*c) + A*a^2)*log(e^(2*I*d*x + 2*I*c) - 1))/(d*e^(2*I*d*x + 2*I*c) + d)

________________________________________________________________________________________

giac [B]  time = 0.88, size = 175, normalized size = 2.33 \[ \frac {A a^{2} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) + {\left (A a^{2} - 2 i \, B a^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right ) - 2 \, {\left (2 \, A a^{2} - 2 i \, B a^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right ) + {\left (A a^{2} - 2 i \, B a^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right ) - \frac {A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 2 i \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 2 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - A a^{2} + 2 i \, B a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

(A*a^2*log(tan(1/2*d*x + 1/2*c)) + (A*a^2 - 2*I*B*a^2)*log(tan(1/2*d*x + 1/2*c) + 1) - 2*(2*A*a^2 - 2*I*B*a^2)
*log(tan(1/2*d*x + 1/2*c) + I) + (A*a^2 - 2*I*B*a^2)*log(tan(1/2*d*x + 1/2*c) - 1) - (A*a^2*tan(1/2*d*x + 1/2*
c)^2 - 2*I*B*a^2*tan(1/2*d*x + 1/2*c)^2 - 2*B*a^2*tan(1/2*d*x + 1/2*c) - A*a^2 + 2*I*B*a^2)/(tan(1/2*d*x + 1/2
*c)^2 - 1))/d

________________________________________________________________________________________

maple [A]  time = 0.44, size = 100, normalized size = 1.33 \[ 2 i A \,a^{2} x +\frac {2 i A \,a^{2} c}{d}-\frac {2 i B \,a^{2} \ln \left (\cos \left (d x +c \right )\right )}{d}+2 a^{2} B x +\frac {a^{2} A \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {a^{2} A \ln \left (\sin \left (d x +c \right )\right )}{d}-\frac {a^{2} B \tan \left (d x +c \right )}{d}+\frac {2 B \,a^{2} c}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x)

[Out]

2*I*A*a^2*x+2*I/d*A*a^2*c-2*I/d*B*a^2*ln(cos(d*x+c))+2*a^2*B*x+1/d*a^2*A*ln(cos(d*x+c))+a^2*A*ln(sin(d*x+c))/d
-a^2*B*tan(d*x+c)/d+2/d*B*a^2*c

________________________________________________________________________________________

maxima [A]  time = 0.73, size = 66, normalized size = 0.88 \[ \frac {{\left (d x + c\right )} {\left (2 i \, A + 2 \, B\right )} a^{2} - {\left (A - i \, B\right )} a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + A a^{2} \log \left (\tan \left (d x + c\right )\right ) - B a^{2} \tan \left (d x + c\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

((d*x + c)*(2*I*A + 2*B)*a^2 - (A - I*B)*a^2*log(tan(d*x + c)^2 + 1) + A*a^2*log(tan(d*x + c)) - B*a^2*tan(d*x
 + c))/d

________________________________________________________________________________________

mupad [B]  time = 6.20, size = 70, normalized size = 0.93 \[ \frac {A\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}-\frac {2\,A\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{d}-\frac {B\,a^2\,\mathrm {tan}\left (c+d\,x\right )}{d}+\frac {B\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,2{}\mathrm {i}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(c + d*x)*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^2,x)

[Out]

(A*a^2*log(tan(c + d*x)))/d - (2*A*a^2*log(tan(c + d*x) + 1i))/d + (B*a^2*log(tan(c + d*x) + 1i)*2i)/d - (B*a^
2*tan(c + d*x))/d

________________________________________________________________________________________

sympy [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: NotInvertible} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+I*a*tan(d*x+c))**2*(A+B*tan(d*x+c)),x)

[Out]

Exception raised: NotInvertible

________________________________________________________________________________________